import React from 'react';
import './index.less';
type infoType = {
  title: string;
  desc: string;
  imgUrl?: string;
};
const InfoCard = ({ info }: { info: infoType }) => {
  function randomStr() {
    return Math.floor(Math.random() * 100);
  }

  return (
    <div className="info-card">
      <div className="info-card-content">
        <div className="info-card-content-title">{info.title}</div>
        <div className="info-card-content-desc">{info.desc}</div>
      </div>
      <div className="info-card-img">
        <img src={info.imgUrl ?? `https://picsum.photos/id/${randomStr()}/180`} alt="" />
      </div>
    </div>
  );
};

export default InfoCard;
